package blog.service.client.impl;

import blog.dao.client.ThumbClientMapper;
import blog.entity.Thumb;
import blog.service.client.ThumbClientService;
import blog.vo.client.ThumbCountVO;
import blog.vo.client.ThumbVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 　　* @description: TODO
 * 　　* @param
 * 　　* @return
 * 　　* @throws
 * 　　* @author Administrator
 * 　　* @date $ $
 *
 */
@Service
public class ThumbClientServiceImpl implements ThumbClientService {
    @Autowired
    private ThumbClientMapper thumbClientMapper;

    @Override
    public int thumbCount(ThumbCountVO thumbCountVO) {
        return thumbClientMapper.thumbCount(thumbCountVO.getBlogUuid());
    }

    @Override
    public int addThumb(ThumbVO thumbVO) {
        return thumbClientMapper.addThumb(thumbVO.getBlogUuid(),thumbVO.getThumbUuid());
    }

    @Override
    public int isAddThumb(ThumbVO thumbVO) {
        Thumb thumb = thumbClientMapper.isAddThumb(thumbVO.getBlogUuid(), thumbVO.getThumbUuid());
        if (thumb == null){
            return 0;
        }
        else {
            return 1;
        }
    }

    @Override
    public int cancelAddThumb(ThumbVO thumbVO) {
        return thumbClientMapper.cancelAddThumb(thumbVO.getBlogUuid(),thumbVO.getThumbUuid());
    }
}
